*Personality Traits in Citizen Expectations towards Public Services
*Journal of Behavioral Public Administration
*Reproducibility code
*Morten Hjortskov
*5/11 2020

clear
set more off, permanently

use "C:\Users\au171393\Documents\Post.doc projekt\Mine artikler\Citizen Expectations\Personality in Citizen Expectations\Reproducibility\Personality and Expectations_data.dta", clear

*Covariates
global cov "gender birthyear b(2).edu i.race income income2 i.urban"
global tipi "extraversion agreeableness conscientiousness emotionalstab openness"

format  birthyear income %9.3f

************************
*Personality measures
************************
*Maximizing scale
alpha max1-max6, item gen(maxscale_notz)
alpha max1-max6, item std //standardized (mean 0, variance 1). Maxscale already created
egen zmaxscale = std(maxscale) //Second standardization

*Reversing items (see Gosling et al 2003, p. 525)
recode q81_6 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q81_2 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q81_8 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q81_4 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)
recode q81_10 (1=7) (2=6) (3=5) (4=4) (5=3) (6=2) (7=1)

pwcorr q81_1-q81_10
factor q81_1-q81_10, blanks(.5)

gen extraversion = (q81_1 + q81_6)/2 //see https://gosling.psy.utexas.edu/scales-weve-developed/ten-item-personality-measure-tipi/
gen agreeableness = (q81_2 + q81_7)/2
gen conscientiousness = (q81_3 + q81_8)/2
gen emotionalstab = (q81_4 + q81_9)/2
gen openness = (q81_5 + q81_10)/2


************************
*Regressing personality traits on predictive and normative expectations
************************

eststo clear

*Only personality traits
regress posexp $tipi maxscale, vce(robust)
eststo p1
regress normexp $tipi maxscale, vce(robust)
eststo p2
*With covariates
regress posexp $tipi maxscale intfirst $cov i.state, vce(robust) beta //used in Figure 1
eststo s1
gen meds1 = e(sample)
regress normexp $tipi maxscale intfirst $cov i.state, vce(robust) beta //used in Figure 1
eststo s2
gen meds2 = e(sample)
*Including political covariates as well
regress posexp $tipi maxscale intfirst $cov i.state poltrust2 i.repdep i.libcons, vce(robust)
eststo e1
regress normexp $tipi maxscale intfirst $cov i.state poltrust2 i.repdep i.libcons, vce(robust)
eststo e2


************************
*Figure 1 - Coefficient Plots
************************
coefplot s1, bylabel(Predictive Expectations) ///
|| s2, bylabel(Normative Expectations) ///
||, keep(maxscale extraversion agreeableness conscientiousness emotionalstab openness) xline(0) ///
coeflabel(extraversion = "Extraversion" agreeableness = "Agreeableness" conscientiousness = "Conscientiousness" ///
emotionalstab = "Emotional Stability" openness = "Openness" maxscale = "Maximizing Tendency Scale" poltrust2 = "Political trust" ///
repdep = "Party Identification" libcons = "Ideology", wrap(30) notick labgap(1)) ///
levels(95) headings(extraversion = "{bf:Big Five}" maxscale = "{bf: Maximizing Tendency}" poltrust2 = "{bf:Political Variables}")

************************
*Table B.2 - Pairwise correlations
************************
pwcorr posexp normexp maxscale extraversion agreeableness conscientiousness emotionalstab openness libcons poltrust repdep, star(.5) obs

************************
*Table B.3 - Full Models
************************
esttab p1 s1 e1 p2 s2 e2 using personalexpectations.rtf, se replace star(+ .1 * .05 ** .01) r2 label b(%9.3f) ///
se(%9.3f) compress nogaps mtitles("Predictive" "Predictive - w. covariates" "Predictive - w. political" "Normative" ///
 "Normative - w. covariates" "Normative - w. political")

************************
*Table B.4 - Test of differences (interaction)
************************
*Generate variable with both predictive and normative expectations
gen bothexp = .
replace bothexp = posexp if posexp!=.
replace bothexp = normexp if normexp!=.

regress bothexp pred##c.extraversion pred##c.agreeableness pred##c.conscientiousness pred##c.emotionalstab pred##c.openness pred##c.maxscale if meds1==1 | meds2==1, vce(robust)
eststo both1

regress bothexp pred##c.extraversion pred##c.agreeableness pred##c.conscientiousness pred##c.emotionalstab pred##c.openness pred##c.maxscale intfirst $cov i.state if meds1==1 | meds2==1, vce(robust) beta
eststo both2

regress bothexp pred##c.extraversion pred##c.agreeableness pred##c.conscientiousness pred##c.emotionalstab pred##c.openness pred##c.maxscale intfirst $cov i.state poltrust2 i.repdep i.libcons if meds1==1 | meds2==1, vce(robust)
eststo both3

esttab both1 both2 both3 using personalexpectationsint.rtf, se replace star(+ .1 * .05 ** .01) r2 label b(%9.3f) ///
se(%9.3f) compress nogaps mtitles("Both" "Both - w. covariates" "Both - w. political")

************************
*Table B.1: Descriptive statistics
************************
format gender income state edu race urban libcons poltrust maxscale extraversion agreeableness conscientiousness emotionalstab openness repdep pos norm posexp normexp %9.2f

sum libcons poltrust maxscale_notz extraversion agreeableness conscientiousness emotionalstab openness repdep posexp normexp gender ibn.income ibn.edu ibn.race ibn.urban if meds1==1 | meds2==1, separator(0) format 

gen age = 2015-(birthyear + 1899)
format age %9.2f
sum age





